failat 21

; set current setting name to "none"
echo "none" >env:sttpsnd_current

if exists envarc:icaros/startup_sound
 copy envarc:icaros/startup_sound TO env:icaros/startup_sound QUIET FOOVR
 list ${icaros/startup_sound} lformat=%N >env:sttpsnd_current
endif

requestchoice >env:choice "Icaros Starup Sound" "Please choose a MP3 sound file.*nOther formats are not supported at this stage.*n*nCurrent: ${sttpsnd_current}" "Disable sound|Choose sound|Cancel"

delete env:sttpsnd_current >NIL:

if ${choice} EQ 1
 delete envarc:icaros/startup_sound >NIL:
 delete env:icaros/startup_sound >NIL:
 skip FINE
EndIf

if ${choice} EQ 0
 skip FINE
EndIf

requestfile >env:icaros/startup_sound_tmp TITLE="Please choose a sound file" DRAWER="SYS:System/Sounds" POSITIVE="Select" NEGATIVE="Cancel" PATTERN="#?mp3#?"

if WARN
 ; debug
 ; echo user chose no file
 skip FINE
EndIf

copy env:icaros/startup_sound_tmp TO envarc:icaros/startup_sound QUIET FOOVR NOPRO
;echo ${icaros/startup_sound_tmp}
delete env:icaros/startup_sound_tmp >NIL:

Lab FINE
delete env:choice >NIL:

; end of file